<?php
namespace ImiDemo\HttpDemo\MainServer\Controller;

use Imi\Controller\HttpController;
use Imi\Server\View\Annotation\View;
use Imi\Server\Route\Annotation\Route;
use Imi\Server\Route\Annotation\Action;
use Imi\Server\Route\Annotation\Controller;
use ImiDemo\HttpDemo\MainServer\Model\Test;

/**
 * Aop 演示
 * @Controller("/Aop/")
 * @View(renderType="json")
 */
class AopController extends HttpController
{
    /**
     * Aop 演示，访问后请看控制台输出
     * Aop 注入操作文件：HttpDemo\MainServer\Aspect\Test.php
     * 访问：http://127.0.0.1:8080/Aop/test
     * 
     * @Action
     * @return void
     */
    public function test()
    {
        $data = Test::find(1);
        $data->setId(123);
        return [
            'data'    =>    $data,
        ];
    }

}